import React, { useEffect, useState } from "react";
import type { GetProp, TableProps } from "antd";
import { Form, Table } from "antd";
import { useAppDispatch, useAppSelector } from "@/store";
import {
  get_sysConfig_page_list,
  selectSysConfigPageList,
} from "@/store/slice/sysConfig";

type ColumnsType<T extends object> = GetProp<TableProps<T>, "columns">;
type TablePagination<T extends object> = NonNullable<
  Exclude<TableProps<T>["pagination"], boolean>
>;

const columns: ColumnsType<SysConfigType> = [
  {
    title: "参数编码",
    dataIndex: "paramCode",
  },
  {
    title: "参数值",
    dataIndex: "paramValue",
  },
  {
    title: "类型",
    dataIndex: "paramType",
  },
  {
    title: "备注",
    key: "remark",
  },
  {
    title: "创建时间",
    key: "createDate",
  },
  {
    title: "更新时间",
    key: "updateDate",
  },
];

const OrgMember: React.FC = () => {
  const [tableParams, setTableParams] = useState<PageType>({
    pagination: {
      current: 1,
      size: 10,
    },
  });
  const dispatch = useAppDispatch();
  const pageList: PageType<SysConfigType> = useAppSelector(
    selectSysConfigPageList
  );
  const data_list = pageList.records;
  console.log(data_list);

  useEffect(() => {
    // 初始化数据
    //dispatch(get_sysConfig_page_list({}));
  }, []);
  return (
    <>
      <Form layout="inline" style={{ marginBottom: 16 }}></Form>
      <Table
        columns={columns}
        dataSource={data_list}
        pagination={tableParams.pagination}
      />
    </>
  );
};

export default OrgMember;
